package com.info.widgets.FeedBack;

import java.util.ArrayList;
import java.util.List;
import java.sql.*;

import com.info.widgets.ConnectionHelper;
import com.info.widgets.DAOException;

import com.info.widgets.FeedBack.*;

public class FeedBackService {
	
	public ArrayList<FeedBack> feedbackCreation(FeedBack feed) throws DAOException{
		System.out.println("feedbackCreation");
		FeedBack feed1=new FeedBack();
		Connection con=null;
		String dbtime=null;
		//String query="SELECT * FROM mycaspian.feedback";
		ArrayList<FeedBack> arrayList = new ArrayList<FeedBack>();
		try {
			con=ConnectionHelper.getConnection();
			Statement stmt=con.createStatement();
			//ResultSet rs=stmt.executeQuery(query);
			PreparedStatement pst = null;
			pst = con.prepareStatement("INSERT INTO mycaspian.feedback(id,about,respond, name, phone_number, comment) VALUES(?, ?, ?, ?, ?, ?) ");
			System.out.println("feedbackCreation ***"+feed.getName());
			
			pst.setString(2,feed.getAbout());
			pst.setString(3,feed.getRespond());
			pst.setString(4,feed.getName());
			pst.setLong(5, feed.getPhone_number());
			pst.setString(6,feed.getCOMMENT());
			
			pst.executeUpdate();
			
			
			
		} catch (Exception e) {
			e.printStackTrace();
			throw new DAOException(e);
			
		}finally {
			ConnectionHelper.close(con);
			
		}
		 return arrayList;
		
		
		
	}
}